function new_warrior(id, x, y, name){

    var up = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }, {
            x : 0,
            y : 2
        } ]
    };

    var right = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }, {
            x : 0,
            y : 2
        } ]
    };

    var down = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }, {
            x : 0,
            y : 2
        } ]
    };

    var left = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }, {
            x : 0,
            y : 2
        } ]
    };
	
    var s_up = {
        cellWidth: 72,
        cellHeight: 72,
        x: 0,
        y: 1,
        offsetX: 36,
        offsetY: 55
    };
	
    var s_right = {
        cellWidth: 72,
        cellHeight: 72,
        x: 0,
        y: 1,
        offsetX: 36,
        offsetY: 55
    };
	
    var s_down = {
        cellWidth: 72,
        cellHeight: 72,
        x: 0,
        y: 1,
        offsetX: 36,
        offsetY: 55
    };
    var s_left = {
        cellWidth: 72,
        cellHeight: 72,
        x: 0,
        y: 1,
        offsetX: 36,
        offsetY: 55
    };
    
    var atk_right = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }]
    };
    
    var atk_left = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }]
    };
    
    var die = {
        cellWidth : 72,
        cellHeight : 72,
        interval : 200,
        offsetX: 36,
        offsetY: 55,
        frames : [ {
            x : 0,
            y : 0
        }, {
            x : 0,
            y : 1
        }, {
            x : 0,
            y : 2
        } , {
            x : 0,
            y : 3
        }, {
            x : 0,
            y : 4
        }, {
            x : 0,
            y : 4
        }, {
            x : 0,
            y : 4
        }, {
            x : 0,
            y : 4
        }, {
            x : 0,
            y : 4
        }]
    };
    
    var img_up = new Image();
    img_up.src = 'classes/warrior/up.png';
    
    var img_down = new Image();
    img_down.src = 'classes/warrior/down.png';
    
    var img_left = new Image();
    img_left.src = 'classes/warrior/left.png';
    
    var img_right = new Image();
    img_right.src = 'classes/warrior/right.png';
    
    var img_atk_right = new Image();
    img_atk_right.src = 'classes/warrior/attack_right.png';
    
    var img_atk_left = new Image();
    img_atk_left.src = 'classes/warrior/attack_left.png';
    
    var img_die = new Image();
    img_die.src = 'classes/warrior/die.png';
    
    var sp1 = new AnimatedSprite(img_up, up);
    sp1.playLoop();
    var sp2 = new AnimatedSprite(img_right, right);
    sp2.playLoop();
    var sp3 = new AnimatedSprite(img_down, down);
    sp3.playLoop();
    var sp4 = new AnimatedSprite(img_left, left);
    sp4.playLoop();
    var sp5 = new ImageSprite(img_up, s_up);
    var sp6 = new ImageSprite(img_right, s_right);
    var sp7 = new ImageSprite(img_down, s_down);
    var sp8 = new ImageSprite(img_left, s_left);
    var sp9 = new AnimatedSprite(img_atk_right, atk_right);
    var sp10 = new AnimatedSprite(img_atk_left, atk_left);
    var sp11 = new AnimatedSprite(img_die, die);
        
    var unit = new Unit(id, x, y, name);
    unit.nameOffsetX = 36;
    unit.nameOffsetY = 45;
    unit.addSprite(Unit.MOVE_UP, sp1);
    unit.addSprite(Unit.MOVE_RIGHT, sp2);
    unit.addSprite(Unit.MOVE_DOWN, sp3);
    unit.addSprite(Unit.MOVE_LEFT, sp4);
    unit.addSprite(Unit.STAND_UP, sp5);
    unit.addSprite(Unit.STAND_RIGHT, sp6);
    unit.addSprite(Unit.STAND_DOWN, sp7);
    unit.addSprite(Unit.STAND_LEFT, sp8);
    unit.addSprite(Unit.ATK_RIGHT, sp9);
    unit.addSprite(Unit.ATK_LEFT, sp10);
    unit.addSprite(Unit.DIE, sp11);
    return unit;
}